<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>例子2</title>
</head>

<body>
    <!-- 登录页面登录后，会需要刷新各个模块的信息（头像、nav等） -->
    <script>
        var ObserverEvent = (function() {
            var clientList = [],
                listen, trigger, remove;
            listen = function(key, fn) {
                if (!clientList[key]) {
                    clientList[key] = [];
                }
                clientList[key].push(fn);
            };
            trigger = function() {
                var key = Array.prototype.shift.call(arguments),
                    fns = clientList[key];
                if (!fns || fns.length === 0) {
                    return false
                }
                for (var i = 0, fn; fn = fns[i++];) {
                    fn.apply(this, arguments)
                }
            };
            remove = function(key, fn) {
                var fns = clientList[key]
            }
        })
    </script>
</body>

</html>